home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3377 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: lerc.nasa.gov!purdue!yuma!steffend
  2. From: steffend@lamar.colostate.edu (Dave Steffen)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Random numbers in C++
  5. Date: 23 Jan 1996 17:53:43 GMT
  6. Organization: Colorado State University, Fort Collins, CO  80523
  7. Message-ID: <4e37b7$1slq@yuma.ACNS.ColoState.EDU>
  8. References: <4e07ge$me7@server1.ctc.com> <310523E6.624C@ntsrv.capacity.dk>
  9. NNTP-Posting-Host: glitch.physics.colostate.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Frank Nielsen (frank.nielsen@ntsrv.capacity.dk) wrote:
  13. > Richard Kemp wrote:
  14. > > 
  15. > > Hi!!
  16. > > 
  17. > > How do you make a random number in C++. I'm not familiar with C, so
  18. > > if it's a C function that will help a lot also. Thanks!!
  19. > > 
  20. > > --
  21. > > Richard Kemp
  22.  
  23. > Hey Richard.
  24.  
  25. > First call "C" function randomize(); at startup.  Then every time
  26. > you need a random number you call random(<max random number>).
  27.  
  28.     Many times, the "system-supplied" random number generator
  29. isn't a very good one, i.e. the output has correlations. If you need a
  30. "really serious" generator (like you're doing numerical work or
  31. something) you might want to check out "Numerical Recipies in C" (2nd
  32. Ed) for some better ones.
  33.  
  34.                                  /\
  35.                                  \/
  36.  
  37. Dave Steffen                      No, his mind is not for rent
  38. Dept. of Physics                  To any God or Government
  39. Colorado State University         Always hopeful, yet discontent
  40. steffend@lamar.colostate edu      He knows changes aren't permanent-
  41.                       But change is...
  42. "Speak softly...                    
  43. ... and carry a black belt!"              -Neal Peart / RUSH
  44. -----------------------------------------------------------------------
  45.  
  46.